<?php
ob_start();
require_once('cls_page.php');
require_once('du_system.php');
if (isset($_GET['@cmd_type'])){DoAction($_GET['@cmd_type']);}	
if (isset($_POST['@cmd_type'])){DoAction($_POST['@cmd_type']);}

function DoAction($act){
	switch ($act){
		case 'add': DUAdd();break;
	}
}

function DUAdd(){
	foreach ($_POST as $key => $value){
		if(substr_count($key,'@')<=0){
			$field .= $key .',';		
			$values.= is_numeric($value)? $value .",":"'".$value."',";
		}
	}
	$field  = preg_replace("/,$/","",$field);
	$values = preg_replace("/,$/","",$values);
	$sql = "INSERT INTO articles ($field)values($values)";
	mysql_query($sql) or die('add err');
	header("location: ".$_POST['@url']);
}
?>